package edu.worldskills.b;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.UUID;

public class ShowPicActivity extends AppCompatActivity {
    private static final String TAG = "ShowPicActivity";

//    StaggeredGridLayoutManager

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_showimg);

        //从MyAPP获取图片
        Bitmap bitmap = MyApp.getInstance().bitmap;

        ImageView imageView = findViewById(R.id.img);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setImageBitmap(bitmap);


        Button bt_down = findViewById(R.id.save);
        bt_down.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Function.saveBitmapToPictures(bitmap, ShowPicActivity.this);
            }
        });

        Button bt_back = findViewById(R.id.back);
        bt_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}